//
//  ViewController.m
//  HXSDKDemo
//
//  Created by 黄德玉 on 2018/6/25.
//  Copyright © 2018年 none. All rights reserved.
//

#import "ViewController.h"
#import "HDChatViewController.h"
#import "YGHXManager.h"

@interface ViewController ()

@property (nonatomic,strong) UIButton * btn;

@end

@implementation ViewController


- (void)viewDidLoad {
    [super viewDidLoad];
    self.btn = [UIButton buttonWithType:UIButtonTypeCustom];
    [self.btn setTitle:@"戳我" forState:UIControlStateNormal];
    self.btn.backgroundColor = [UIColor brownColor];
    self.btn.frame = CGRectMake(0, 0, 100, 100);
    self.btn.center = self.view.center;
    [self.view addSubview:self.btn];
    [self.btn addTarget:self action:@selector(btnClicked:) forControlEvents:UIControlEventTouchUpInside];
}

- (void)btnClicked:(UIButton *)btn{
    NSLog(@"初始化聊天中================================================================");
    [[YGHXManager sharedManger] setup];
    NSLog(@"注册用户====================================================================");
    [[YGHXManager sharedManger] registerUserWithCallback:^(NSError *err, id responseObject) {
        
    }];
    NSLog(@"开始登陆=====================================================================");
    [[YGHXManager sharedManger] login];
    NSLog(@"登陆成功后跳转，到聊天==========================================================");
    HDChatViewController * vc = [[HDChatViewController alloc] initWithConversationChatter:YG_IM_FUWUHAO];
    [self.navigationController pushViewController:vc animated:YES];
    
}


@end
